//
//  WXApiManager.m
//  SDKSample
//
//  Created by Jeason on 16/07/2015.
//
//

#import "QQApiManager.h"
#import <TencentOpenAPI/QQApiInterface.h>

@interface QQApiManager ()

@end

@implementation QQApiManager

+ (instancetype)sharedManager {
    static dispatch_once_t onceToken;
    static QQApiManager * instance;
    dispatch_once(&onceToken, ^{
        instance = [[QQApiManager alloc] init];
    });
    return instance;
}

- (void)dealloc {
    self.delegate = nil;
}

#pragma mark - QQApiInterfaceDelegate

- (void)onReq:(QQBaseReq *)req {
    switch (req.type)
    {
        case EGETMESSAGEFROMQQREQTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidGetMessageFromQQReq:)]) {
                [self.delegate qqManagerDidGetMessageFromQQReq:req];
            }
            break;
        }
        case ESENDMESSAGETOQQREQTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidSendMessageToQQReq:)]) {
                [self.delegate qqManagerDidSendMessageToQQReq:req];
            }
            break;
        }
        case ESHOWMESSAGEFROMQQREQTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidShowMessageFromQQReq:)]) {
                [self.delegate qqManagerDidShowMessageFromQQReq:req];
            }
            break;
        }
        default:
        {
            break;
        }
    }
}

- (void)onResp:(QQBaseResp *)resp {
    switch (resp.type)
    {
        case EGETMESSAGEFROMQQRESPTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidGetMessageFromQQResp:)]) {
                [self.delegate qqManagerDidGetMessageFromQQResp:resp];
            }
            break;
        }
        case ESENDMESSAGETOQQRESPTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidSendMessageToQQResp:)]) {
                [self.delegate qqManagerDidSendMessageToQQResp:resp];
            }
            break;
        }
        case ESHOWMESSAGEFROMQQRESPTYPE:
        {
            if (self.delegate && [self.delegate respondsToSelector:@selector(qqManagerDidShowMessageFromQQResp:)]) {
                [self.delegate qqManagerDidShowMessageFromQQResp:resp];
            }
            break;
        }
        default:
        {
            break;
        }
    }
}

@end
